package org.agile4j.patterns.command.template;

/**
 * 具体的命令实现对象
 * @author user
 *
 */
public class ConcreteCommand implements Command {

	/**
	 * 持有相应的接受者对象
	 */
	private Receiver receiver = null ;
	
	/**
	 * 示意, 命令对象可以有自己的状态
	 */
	private String state ;
	
	/**
	 * 构造方法, 传入相应的接受者对象
	 * @param receiver
	 */
	public ConcreteCommand(Receiver receiver){
		this.receiver = receiver ;
	}
	
	@Override
	public void excute() {
		// 通常会转调接受者对象的相应方法, 让接受者真正执行功能
		this.receiver.action();
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}
	
}
